package problema079;

import java.io.BufferedReader;
import java.io.FileReader;

public class PasscodeDerivation {
	
	static int[] pass;
	
	public static void main(String[] args){
		minPass();
	}
	
	public static void minPass(){
		leer();
		boolean[][] aparecen = new boolean[10][3];
		int act = 0, pos = 2;
		for(int i = 0; i < pass.length; i++){
			act = pass[i];
			while(act != 0){
				aparecen[act % 10][pos] = true;
				pos--;
				act /= 10;
			}
			pos = 2;
		}
		System.out.println("   1°  " + "  2°  " + "  3° ");
		for(int i = 0; i < 10; i++){
			System.out.print(i + " ");
			for(int j = 0; j < 3; j++){
				if(aparecen[i][j]){
					System.out.print(aparecen[i][j] + "  ");
				}else{
					System.out.print(aparecen[i][j] + " ");
				}
			}
			System.out.println();
		}
		System.out.println("Deducida del orden de los numero la pass es: " +  73162890);
	}
	
	public static void leer(){
		pass = new int[50];
		int pos = 0;
		try{
			BufferedReader reader = new BufferedReader( new FileReader("keylogEj79.txt") );
			String linea;
			while ((linea = reader.readLine()) != null){
				pass[pos] = Integer.parseInt(linea);
				pos++;
			}
			reader.close();
			}catch (Exception e){
				System.err.println("Error: " + e.getMessage());
			}
	}

}
